package com.liu.demo.excel;


import com.alibaba.excel.EasyExcel;
import java.util.ArrayList;
import java.util.List;


public class WriterExcelSheet {


    public static void main(String[] args) {

        // 需要写入的excel表的绝对路径(底层会自动创建一张表)
        String sheetPath = "E:\\Tools\\JAVA_IDE\\java_code\\guli_parent\\service\\service_edu1\\src\\test\\java\\com\\liu\\demo\\excel\\student.csv";

        // 创建写的类。
        EasyExcel.write(sheetPath, ExcelSheet.class).sheet("学生信息表").doWrite(method());

    }

    public static List<ExcelSheet> method() {
        List<ExcelSheet> list = new ArrayList<>();


        for (int i = 0; i < 10; i++) {
            ExcelSheet excelSheet = new ExcelSheet();
            excelSheet.setId(i);
            excelSheet.setName("欧阳修" + 1);
            list.add(excelSheet);
        }
        return list;
    }
}
